import request from './request'
const apiKey = import.meta.env.VITE_API_KEY
//根据ip查询城市
export const getCityData = () => {
  return request({
    method: 'GET',
    url: `/ip?key=${apiKey}`,
  })
}
//查询adcode
export const getAdcodeData = (address) => {
  return request({
    method: 'GET',
    url: `/geocode/geo?key=${apiKey}&address=${address}`,
  })
}
//实时天气
export const getWeatherData = (adcode) => {
  return request({
    method: 'GET',
    url: `/weather/weatherInfo?city=${adcode}&key=${apiKey}`,
  })
}
//预报天气
export const getFutureWeatherData = (adcode) => {
  return request({
    method: 'GET',
    url: `/weather/weatherInfo?city=${adcode}&key=${apiKey}&extensions=all`,
  })
}
//根据关键字查询城市
export const getSearchCity = (keyword) => {
  return request({
    method: 'GET',
    url: `/config/district?keywords=${keyword}&key=${apiKey}`,
  })
}
